package com.test.util;

import org.apache.commons.lang3.StringUtils;


/**
 * @Author lizhilong
 * @create 2020/1/6 16:34
 * @desc
 */
public class StringUtil {

    private static final String DEFAULT_NAME = ".jpg";

    public static String getImageName(String title, String index, String suffixName) {
        if (StringUtils.isEmpty(suffixName)) {
            suffixName = DEFAULT_NAME;
        }
        if (StringUtils.isEmpty(title)) {
            return null;
        }
        if (StringUtils.isEmpty(index)) {
            return title + "_" + System.currentTimeMillis() + suffixName;
        }
        return title + "_" + index + suffixName;
    }
}
